package com.boang.entity;

/*
  @author: 13813
  @date: 2024/11/19 9:28
*/
public class Bank {
    //    public SavingAccount[] sa = new SavingAccount[2];
//    public CreditAccount[] ca = new CreditAccount[1];
    public Account[] accounts = new Account[2];

    public Bank() {
//        sa[0] = new SavingAccount("a", "a", 3000);
//        sa[1] = new CreditAccount("b", "b", 1000);
        accounts[0] = new SavingAccount("a", "a", 3000);
        accounts[1] = new CreditAccount("b", "b", 1000);
    }

    public Account verify(String cardNo, String pass) {
        for (int i = 0; i < accounts.length; i++) {
            Account account = accounts[i];
            if (account.cardNo.equals(cardNo) && account.passwd.equals(pass)) {
                return account;
            }
        }
        return null;
    }

    public void saveMoney(int money, Account account) {
        account.save(money);
    }

    public void depositMoney(int money, Account account) {
        account.deposit(money);
    }

}
